<div class="animated fadeIn">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <i class="fas fa-align-justify"></i> 搜索结果
                </div>
                <div class="card-body">

                    <table class="layui-table table-hover">
                        <thead>
                        <tr>
                            <th>文件名</th>
                            <th>文件类型</th>
                            <th>文件长度</th>
                            <th>上传日期</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        <tr th:each="file : ${files}">
                            <form th:action="@{/deleteFile}" th:method="DELETE">
                                <td>
                                    <a th:href="@{'file/preview/'+${file.id}}">
                                        <i th:class="${file.iconClass}"></i>
                                        <span th:text="${file.filename}"></span>
                                    </a>
                                </td>
                                <td th:text="${file.type}">文件类型</td>
                                <td th:text="${#numbers.formatInteger(file.length,3,'COMMA')}">文件大小</td>
                                <td th:text="${#dates.format(file.uploadDate,'yyyy-MM-dd HH:mm:ss')}">上传日期</td>
                                <td>
                                    <div class="input-group">
                                        <input type="hidden" id="fileId" name="fileId"
                                               th:value="${file.id}"/>
                                        <input th:if="${file.deleteAuthorization}" type="submit"
                                               value="&#xf2ed" class="btn btn-danger far fa-trash-alt"/>
                                        <a th:href="@{'file/download/'+${file.id}}" class="btn btn-dark">
                                            <i class="fas fa-cloud-download-alt"></i>
                                        </a>
                                    </div>
                                </td>
                            </form>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <!--/.row-->
        </div>
    </div>
</div>

<script th:inline="javascript">

    layui.use(['table', 'form'], function () {
        var form = layui.form
            , table = layui.table;

        $('.folder-link').click(function() {
            var folderUrl = $(this).parents('tr').children('td').eq(0).find("#subFolderLink").val();
            //alert(folderUrl);
            setUpUrl(folderUrl);
        });

    });
</script>
